FirstBit
You can use theFirstBit
function to determine the highest order bit that is set in a number.
short FirstBit (unsigned long x);
x
- The number for which the first bit is to be determined.
- function result
- The bit number of the highest order bit of the number in the argument.
DESCRIPTION
TheFirstBit
function returns the bit number of the highest order bit in a number that is set, or -1 if the number is 0. The highest-order bit is bit 31; the lowest-order bit is bit 0.DESCRIPTION
The use of theFirstBit
function is described in the section "Analyzing the Bits in a Number" on page 8-33.